<%-- 
    Document   : index.jsp
    Created on : 28-lug-2012, 14.08.28
    Author     : Diego64
--%>

<%@page import="java.util.List"%>
<%@page import="javax.persistence.EntityManagerFactory"%>
<%@page import="multiface.promonet.jpa.util.PersistenceManager"%>
<%@page import="javax.persistence.EntityManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
            EntityManagerFactory emf = PersistenceManager.getInstance().getEntityManagerFactory();
            EntityManager em = emf.createEntityManager();


            List<Object[]> stat_browser = em.createNativeQuery("SELECT count(*) as number, user_agent  FROM `promo_net`.`logdb` GROUP by user_agent").getResultList();

            for (Object[] sArr : stat_browser) {
                out.print(sArr[0] + " , " + sArr[1] + "<br>");
            }

            em.close();
        %>
    </body>
</html>
